<template>

    <div id="jvm">
        <a-back-top/>
        <a-row :gutter="16" class="card">
            <a-col :span="6" >
                <a-card title="JVM信息" :bordered=false >
                    <span>jvm姓名</span>:<span>{{jvminfo.jvmName}}</span><br>
                    <span>jvm库路径</span>:<span>{{jvminfo.jlib}}</span>
                </a-card>
            </a-col>
            <a-col :span="6" >
                <a-card title="os信息" :bordered=false >
                    <span>os姓名</span>:<span>{{jvminfo.osName}}</span><br>
                    <span>os架构</span>:<span>{{jvminfo.osArch}}</span><br>
                    <span>osCPU数量</span>:<span>{{jvminfo.osCpus}}</span><br>
                    <span>os版本</span>:<span>{{jvminfo.osVersion}}</span><br>
                </a-card>
            </a-col>
            <a-col :span="6" >
                <a-card title="线程信息" :bordered=false >
                    <span>当前线程数</span>:<span>{{jvminfo.countThreadNumbers}}</span><br>
                    <span>当前守护线程数</span>:<span>{{jvminfo.daemonThreadNumbers}}</span><br>
                </a-card>
            </a-col>
            <a-col :span="6" >
                <a-card title="内存信息" :bordered=false >
                    <span>总内存数</span>:<span>{{jvminfo.totalmem}}</span><br>
                    <span>空闲内存数</span>:<span>{{jvminfo.freemem}}</span><br>
                    <span>最大堆数</span>:<span>{{jvminfo.maxmem}}</span><br>
                </a-card>
            </a-col>

        </a-row>

    </div>

</template>

<script>
    const fakedata = {
        jlib: "/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib",
        totalmem: "496500736",
        osCpus: "4",
        osVersion: "4.15.0-46-generic",
        osName: "Linux",
        maxmem: "2647130112",
        daemonThreadNumbers: "35",
        jvmName: "14504@zhanghanlin",
        countThreadNumbers: "40",
        osArch: "amd64",
        freemem: "251273712",
        lines: "\n"
    };
    export default {
        name: "JVM",
        data() {
            return {
                jvminfo: fakedata,
            }
        },
        methods: {
            getjvmInfo(){
                this.$api.get("jvm/jvminfo",{},res=>{
                    this.jvminfo = res.data
                })
            }
        },
        mounted() {
            this.getjvmInfo()
        }
    }
</script>

<style scoped>
    #jvm{
        background-color: #ececec;
        padding: 20px;
    }
    .card{
        text-align: center;
    }
</style>